<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:ca="http://java.sun.com/jsf/composite/cashier">


    <ui:define name="content">

        <h:panelGroup rendered="true" >
            <h:form>
                <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder" header="Casheir Detailed Summary">
                    <p:panel>
                        <f:facet name="header" >
                            <h:outputLabel value="#{commonReport.webUser.institution.name}"/> <br/>

                            <h:outputLabel value="Cashier Summary Report - &nbsp;&nbsp; #{commonReport.webUser.webUserPerson.name}"/>




                        </f:facet>


                        <h:panelGrid columns="24" styleClass="noPrintButton" style="width: 60%">
                            <h:outputLabel  value="From Date"/>
                            <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" styleClass="noPrintButton"  >
                            </p:calendar>

                            <h:outputLabel value="To Date"/>
                            <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" styleClass="noPrintButton"  >
                            </p:calendar>

                            <p:commandButton id="btnProcess" ajax="false" value="Process" styleClass="noPrintButton"
                                             style="float: right;" actionListener="#{channelReportController.createChannelCashierSummeryTable()}" />
                            
                            <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                                <p:printer target="reportPrint"  />
                            </p:commandButton>
                            <p:defaultCommand target="btnProcess"/>

                        </h:panelGrid>

                        <!--                        <h:panelGrid columns="2" styleClass="printBlock"  style="min-width: 100%;">
                        
                                                    <h:panelGroup >
                        
                                                        <h:outputLabel value="Fromtyuii" />
                                                        <h:outputLabel  value="#{commonReport.fromDate}" >
                                                            <f:convertDateTime pattern="dd MM yyyy"/>
                                                        </h:outputLabel>
                                                        <h:outputLabel value="To" />
                                                        <h:outputLabel  value="#{commonReport.toDate}" >
                                                            <f:convertDateTime pattern="dd MM yyyy"/>
                                                        </h:outputLabel>
                                                    </h:panelGroup >
                        
                                                </h:panelGrid>
                                                <p:panelGrid columns="2" styleClass="alignTop" style="width: 60%">
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Amount" />
                                                    <h:outputLabel value="Cash" />
                                                    <h:outputLabel value="#{channelReportController.total}" />
                                                    <h:outputLabel value="Cheque" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Credit" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Slip" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Total" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Doctor Fees" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="" />
                                                    <h:outputLabel value="Net Total" />
                                                    <h:outputLabel value="" />
                                                    
                                                </p:panelGrid>-->

                        <p:dataTable value="#{channelReportController.channelReportColumnModels}" id="datatbl" var="chm">
                            
                            <p:column headerText="PaymentMethod" style="text-align: center;">
                                <f:facet name="header">
                                    <h:outputLabel value="PaymentMethod"></h:outputLabel>
                                </f:facet>
                                <h:outputLabel value="\        " />
                                <h:outputLabel value="#{chm.paymentMethod}"/>
                                <f:facet name="footer">
                                    <h:outputLabel value="Total"></h:outputLabel>
                                </f:facet>
                            </p:column>
                            
                            <p:column headerText="Bill Amount" style="text-align: center;">
                                <f:facet name="header">
                                    <h:outputLabel value="Bill Amount"></h:outputLabel>
                                </f:facet>
                                <h:outputLabel value="#{chm.billedTotal}"/>
                                <f:facet name="footer">
                                    <h:outputLabel value="#{channelReportController.grantTotalBilled}"></h:outputLabel>
                                </f:facet>
                            </p:column>
                            
                            <p:column headerText="Cancell Amount" style="text-align: center;">
                                <f:facet name="header">
                                    <h:outputLabel value="Cancell Amount"></h:outputLabel>
                                </f:facet>
                                <h:outputLabel value="#{chm.cancellTotal}"/>
                                <f:facet name="footer">
                                    <h:outputLabel value="#{channelReportController.grantTotalCancel}"></h:outputLabel>
                                </f:facet>
                            </p:column>
                            
                            <p:column headerText="Refund Amount" style="text-align: center;">
                                <f:facet name="header">
                                    <h:outputLabel value="Refund Amount"></h:outputLabel>
                                </f:facet>
                                <h:outputLabel value="#{chm.refundTotal}"/>
                                <f:facet name="footer">
                                    <h:outputLabel value="#{channelReportController.grantTotalRefund}"></h:outputLabel>
                                </f:facet>
                            </p:column>
                            
                            <p:column headerText="Total" style="text-align: center;">
                                <h:outputLabel value="#{chm.total}"/>
                                <f:facet name="footer">
                                    <h:outputLabel value="#{channelReportController.grantNetTotal}"></h:outputLabel>
                                </f:facet>
                            </p:column>
                            
                        </p:dataTable>
                        
                        <p:panelGrid columns="2">
                            <h:outputLabel value="Doctor Fees"></h:outputLabel>
                            <h:outputLabel value="#{channelReportController.doctorFeeTotal}"></h:outputLabel>
                        </p:panelGrid>
                        
                        <p:spacer height="30"/>
                         <p:panelGrid columns="2">
                            <h:outputLabel value="Net Total"></h:outputLabel>
                            <h:outputLabel value="#{channelReportController.grantNetTotal-channelReportController.doctorFeeTotal}"></h:outputLabel>
                        </p:panelGrid>
                        
                        <p:spacer height="30"/>

                        <h:panelGrid columns="1">
                            <h:outputLabel value="Cashier : #{commonReport.webUser.webUserPerson.name}"/>
                            <br/>
                            <h:outputLabel value="............................"/>
                        </h:panelGrid>


                        <div style="page-break-after: always;">
                            <br/>
                        </div>

                        <ca:pettyBills data="#{commonReport.userPettyPaymentBills}"/>

                        <p:spacer height="30"/>

                        <ca:pettyCancel data="#{commonReport.userPettyPaymentCancelBills}"/>
                    </p:panel>
                </p:panel>
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
